import sys
from tkinter.filedialog import FileDialog

from PyQt6.QtCore import Qt, QUrl
from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QFileDialog
from PyQt6.QtGui import QIcon, QFont

app = QApplication(sys.argv)

# ========== 窗口对象 ==========
window = QWidget()
# 窗口标题
window.setWindowTitle("我的工具箱")
# 窗口图标
window.setWindowIcon(QIcon('./baire slogin.png'))
# 重置大小
window.resize(500, 500)
# 窗口位置
# 从左上角开始算
window.move(400, 400)
# 透明度
# 范围是从0.0（完全透明）到1.0（完全不透明）
window.setWindowOpacity(1)
# 窗口状态
# window.setWindowState(Qt.WindowState.WindowActive)

window.setWindowFlag(Qt.WindowType.WindowCloseButtonHint, True)

# label = QLabel("哈哈哈哈")
# label.setAlignment(Qt.AlignmentFlag.AlignCenter)
# label.setWordWrap(True)
# label.setFont(QFont(""))
# label.setParent(window)
# label.setStyleSheet("312312")

# ========== 文本框对象 ==========
# label = QLabel()
# 父类信息，如果不定义，会自己新建一个窗口承载
# label.setParent(window)
# label.setText("我是一个窗口")
# label.setWindowTitle("这个是文本框的 Title")
# label.setNum(5)
# label.setAlignment(Qt.AlignmentFlag.AlignRight)

file_dialog = QFileDialog()
file_dialog.setLabelText(QFileDialog.DialogLabel.Accept, '确认')
file_dialog.setLabelText(QFileDialog.DialogLabel.Reject, '取消')
file_dialog.setFileMode(QFileDialog.FileMode.ExistingFile)
file_dialog.setViewMode(QFileDialog.ViewMode.List)
options = QFileDialog.options(file_dialog)
# file_dialog.open()
pathList, _ = file_dialog.getOpenFileNames(window, "选择文件位置", '/Users/tianfeng/workbench/project/python/')

# print(pathList)
print(file_dialog.selectedUrls())
print(file_dialog.selectedFiles())

# 窗口的显示方法
window.show()

sys.exit(app.exec())
